package design2.template_method.example;

import design2.template_method.example.networks.Facebook;
import design2.template_method.example.networks.Network;
import design2.template_method.example.networks.Twitter;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Demo {
	public static void main(String[] args) throws IOException {
		BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));
		Network network=null;

		System.out.println("请输入用户名：");
		String userName= reader.readLine();
		System.out.println("请输入密码：");
		String password=reader.readLine();

		System.out.println("请输入消息");
		String massage=reader.readLine();

		System.out.println("请选择消息要发送的社交网络：");
		System.out.println("1：Facebook 2：Twitter");
		int choice=Integer.parseInt(reader.readLine());

		if(choice==1){
			network=new Facebook(userName,password);
		}else{
			network=new Twitter(userName,password);
		}
		network.post(massage);

	}
}
